package com.fastloan.mgt.application.contract.service.impl.contractmode.mode;

import com.fastloan.mgt.application.base.enums.ApplicationStatusEnum;
import com.fastloan.mgt.application.base.model.Application;
import com.fastloan.mgt.application.contract.service.impl.contractmode.ContractMode;
import com.fastloan.mgt.product.basics.model.Product;
import com.fastloan.mgt.product.enums.ProductType;
import org.springframework.stereotype.Component;

/**
 * 普通签约
 *
 * @author yanwe
 * createTime 2018-01-2018/1/7 13:18
 */
@Component
public class NormalContract extends ContractMode {

    @Override
    public void contract(Application application, Product product) {
        if (product.getAmountSign().equals(1)) {
            applicationService.modifyApplicationStatus(application.getApplicationId(), ApplicationStatusEnum.WAIT_SIGNED);
        } else {
            applicationService.modifyApplicationStatus(application.getApplicationId(), ApplicationStatusEnum.WAIT_AFFIRM);
        }
    }

    @Override
    public Integer contractType() {
        return ProductType.SLG_SIM.getType();
    }
}
